--TEST--
string MySQLndUhConnection::getServerInformation(resource $connection)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
	require_once('config.inc');

	class proxy extends MySQLndUhConnection {
		public function getServerInformation($res) {
			printf("%s(%s)\n", __METHOD__, var_export(func_get_args(), true));
			var_dump($ret = parent::getServerInformation($res));
			return $ret;
		}
	}

	class proxy2 extends MySQLndUhConnection {
		public function getServerInformation($res) {
			return "my server version";
		}
	}

	class proxy3 extends MySQLndUhConnection {
		public function getServerInformation($res) {
			return $res;
		}
	}

	class proxy4 extends MySQLndUhConnection {
		public function getServerInformation($res) {}
	}

	class proxy5 extends MySQLndUhConnection {
		public function getServerInformation($res) {
			return str_repeat('a', 4096);
		}
	}

	$conn = mysqlnd_uh_test\connect::mysqli();
	mysqlnd_uh_test\query_test::mysqli($conn);
	$org = $conn->server_info;

	$conn = mysqlnd_uh_test\connect::mysqli();
	mysqlnd_uh_set_connection_proxy(new proxy());
	mysqlnd_uh_test\query_test::mysqli($conn);

	if (($tmp = $conn->server_info) != $org)
		printf("[001] Server info has changed from %s to %s\n", $org, $tmp);

	mysqlnd_uh_set_connection_proxy(new proxy2());
	var_dump($conn->server_info);

	mysqlnd_uh_set_connection_proxy(new proxy3());
	var_dump($conn->server_info);

	mysqlnd_uh_set_connection_proxy(new proxy4());
	var_dump($conn->server_info);

	mysqlnd_uh_set_connection_proxy(new proxy5());
	var_dump($conn->server_info);

	print "done!";
?>
--EXPECTF--
proxy::getServerInformation(array (
  0 => NULL,
))
string(%d) "%s"
string(17) "my server version"

Warning: main(): (MySQLnd User Handler) The method MySQLndUhConnection::getServerInformation() did not return a string value as it should in %s on line %d
NULL

Warning: main(): (MySQLnd User Handler) The method MySQLndUhConnection::getServerInformation() did not return a string value as it should in %s on line %d
NULL

Warning: main(): (MySQLnd User Handler) The method MySQLndUhConnection::getServerInformation() should not return a string longer than MYSQLND_UH_SERVER_INFO_LENGTH - 1 characters. The return value will be trimmed in %s on line %d
string(%d) "%s"
done!